package com.lutzyt.delivery.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 该配置类主要用来配置url到页面的配置。
 *
 * @author zyt
 */
@Configuration
public class ThymeleafConfig implements WebMvcConfigurer {

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    // 登录页
    registry.addViewController("/loginPage").setViewName("login/login");
    registry.addRedirectViewController("/", "/loginPage");
    registry.addViewController("/home").setViewName("/home");
    // 菜单
    registry.addViewController("/menu").setViewName("/menu/menu");
    registry.addViewController("/menu/add").setViewName("/menu/addOrUpdate");
    registry.addViewController("/menu/update").setViewName("/menu/addOrUpdate");
    // 用户
    registry.addViewController("/user").setViewName("/user/user");
    registry.addViewController("/user/add").setViewName("/user/addOrUpdate");
    registry.addViewController("/user/update").setViewName("/user/addOrUpdate");
    registry.addViewController("/user/role").setViewName("/user/checkRole");
    // 角色
    registry.addViewController("/role").setViewName("/role/role");
    registry.addViewController("/role/add").setViewName("/role/addOrUpdate");
    registry.addViewController("/role/update").setViewName("/role/addOrUpdate");
    registry.addViewController("/role/permission").setViewName("/role/checkPermission");
    // 权限
    registry.addViewController("/permission").setViewName("/permission/permission");
    registry.addViewController("/permission/menu").setViewName("/permission/checkMenu");
    registry.addViewController("/permission/add").setViewName("/permission/addOrUpdate");
    registry.addViewController("/permission/update").setViewName("/permission/addOrUpdate");
    // 客户
    registry.addViewController("/customer").setViewName("/customer/customer");
    registry.addViewController("/customer/add").setViewName("/customer/addOrUpdate");
    registry.addViewController("/customer/update").setViewName("/customer/addOrUpdate");
    // 骑手
    registry.addViewController("/horseman").setViewName("/horseman/horseman");
    registry.addViewController("/horseman/add").setViewName("/horseman/addOrUpdate");
    registry.addViewController("/horseman/update").setViewName("/horseman/addOrUpdate");
    registry.addViewController("/horseman/comment/audit").setViewName("/horseman/commentAudit");
    // 商铺
    registry.addViewController("/shop").setViewName("/shop/shop");
    registry.addViewController("/shop/add").setViewName("/shop/addOrUpdate");
    registry.addViewController("/shop/update").setViewName("/shop/addOrUpdate");
    // 地址
    registry.addViewController("/address").setViewName("/address/address");
    registry.addViewController("/address/add").setViewName("/address/addOrUpdate");
    registry.addViewController("/address/update").setViewName("/address/addOrUpdate");
    // 商品
    registry.addViewController("/commodity").setViewName("/commodity/commodity");
    registry.addViewController("/commodity/add").setViewName("/commodity/addOrUpdate");
    registry.addViewController("/commodity/update").setViewName("/commodity/addOrUpdate");
    registry.addViewController("/commodity/audit").setViewName("/commodity/audit");
    registry.addViewController("/commodity/comment/audit").setViewName("/commodity/commentAudit");
    // 优惠券
    registry.addViewController("/discountCoupon").setViewName("/discountCoupon/discountCoupon");
    registry.addViewController("/discountCoupon/item").setViewName("/discountCoupon/item");
    registry.addViewController("/discountCoupon/add").setViewName("/discountCoupon/addOrUpdate");
    registry.addViewController("/discountCoupon/update").setViewName("/discountCoupon/addOrUpdate");
    registry.addViewController("/discountCoupon/audit").setViewName("/discountCoupon/audit");
    // 订单
    registry.addViewController("/order").setViewName("/order/order");
    registry.addViewController("/order/comment/audit").setViewName("/order/commentAudit");
    registry.addViewController("/order/item").setViewName("/order/item");
  }
}
